﻿package com.amcharts
{
    import com.amcharts.chartClasses.*;
    import com.amcharts.events.*;
    import com.amcharts.geom.*;
    import com.amcharts.pie.*;
    import com.amcharts.utils.*;
    import flash.display.*;
    import flash.events.*;
    import flash.net.*;
    import flash.text.*;
    import flash.utils.*;
    import mx.collections.*;
    import mx.core.*;
    import mx.effects.easing.*;
    import mx.styles.*;
    import mx.utils.*;

    public class AmPieChart extends AmChart
    {
        protected var _labelsContainer:Sprite;
        protected var _clipLabels:Boolean;
        protected var _visibleInLegendField:String;
        protected var _labels:Array;
        protected var _titleField:String;
        protected var _labelsContainerOld:Sprite;
        protected var _hoverAlpha:Number;
        protected var _urlField:String;
        protected var _pullOutOnlyOne:Boolean;
        protected var _pieContainer:Sprite;
        protected var _balloonText:String;
        protected var _pullOutDuration:Number;
        protected var _slices:Array;
        protected var _pieContainerOld:Sprite;
        protected var _urlTarget:String = "_self";
        protected var _valueField:String;
        protected var _timeOuts:Array;
        protected var _radius:Number;
        protected var _pullOutEffect:Function;
        protected var _descriptionField:String;
        protected var _pullOutRadius:Number;
        protected var _innerRadius:Number;
        protected var _alphaField:String;
        protected var _colorField:String;
        protected var _labelsTicks:Array;
        protected var _pulledField:String;
        static const VERSION:String = "1.8.3.1";
        private static var stylesInited:Boolean = initStyles();

        public function AmPieChart()
        {
            return;
        }// end function

        public function set titleField(param1:String) : void
        {
            _dataChanged = true;
            _titleField = param1;
            invalidateProperties();
            invalidateDisplayList();
            return;
        }// end function

        public function get valueField() : String
        {
            return _valueField;
        }// end function

        protected function removeOld() : void
        {
            Utils.removeChildren(_labelsContainerOld);
            Utils.removeChildren(_pieContainerOld);
            if (_labelsContainerOld)
            {
                if (_labelsContainerOld.parent == this)
                {
                    this.removeChild(_labelsContainerOld);
                }
            }
            if (_pieContainerOld)
            {
                if (_pieContainerOld.parent == this)
                {
                    this.removeChild(_pieContainerOld);
                }
            }
            return;
        }// end function

        override protected function updateDisplayList(param1:Number, param2:Number) : void
        {
            super.updateDisplayList(param1, param2);
            destroy();
            if (this.height)
            {
            }
            if (this.width)
            {
                if (_previousHeight >= this.height)
                {
                }
                if (_previousWidth < this.width)
                {
                    getMargins();
                }
                if (_chartDataProvider.length > 0)
                {
                    createPie();
                }
                else
                {
                    showError("no data found");
                }
            }
            _previousHeight = this.height;
            _previousWidth = this.width;
            callLater(removeOld);
            return;
        }// end function

        protected function checkOverlapping(param1:Number, param2:Number, param3:Boolean, param4:Number) : void
        {
            var _loc_5:Boolean = false;
            var _loc_6:int = 0;
            var _loc_7:Slice = null;
            if (param3 == true)
            {
                _loc_6 = param1 + 1;
                while (_loc_6 < _chartDataProvider.length)
                {
                    
                    _loc_7 = _chartDataProvider.getItemAt(_loc_6) as Slice;
                    if (_loc_7.labelQuarter == param2)
                    {
                    }
                    if (!_loc_7.hidden)
                    {
                    }
                    if (_labels[_loc_6])
                    {
                        if (_labels[param1].hitTestObject(_labels[_loc_6]) == true)
                        {
                            _loc_5 = true;
                        }
                    }
                    _loc_6 = _loc_6 + 1;
                }
            }
            else
            {
                _loc_6 = param1 - 1;
                while (_loc_6 >= 0)
                {
                    
                    _loc_7 = _chartDataProvider.getItemAt(_loc_6) as Slice;
                    if (_loc_7.labelQuarter == param2)
                    {
                    }
                    if (!_loc_7.hidden)
                    {
                    }
                    if (_labels[_loc_6])
                    {
                        if (_labels[param1].hitTestObject(_labels[_loc_6]) == true)
                        {
                            _loc_5 = true;
                        }
                    }
                    _loc_6 = _loc_6 - 1;
                }
            }
            if (_loc_5 == true)
            {
            }
            if (param4 < 100)
            {
                moveLabel(param1, param2, param3, (param4 + 1));
            }
            return;
        }// end function

        public function set valueField(param1:String) : void
        {
            _dataChanged = true;
            _valueField = param1;
            invalidateProperties();
            invalidateDisplayList();
            return;
        }// end function

        override protected function updateData() : void
        {
            var _loc_3:Slice = null;
            var _loc_4:Object = null;
            getMargins();
            _labelsContainerOld = _labelsContainer;
            _pieContainerOld = _pieContainer;
            createChildren();
            if (!_valueField)
            {
                showError("valueField is not set");
            }
            if (!_titleField)
            {
                showError("titleField is not set");
            }
            _chartDataProvider = new ArrayCollection();
            var _loc_1:* = _dataProvider.length;
            var _loc_2:Number = 0;
            while (_loc_2 < _loc_1)
            {
                
                _loc_3 = new Slice();
                _loc_4 = _dataProvider.getItemAt(_loc_2);
                if (!_loc_4.hasOwnProperty(_valueField))
                {
                    showError("\'" + _valueField + "\'" + " field was not found in your dataProvider");
                }
                _loc_3.value = _loc_4[_valueField];
                if (_loc_4.hasOwnProperty(_titleField))
                {
                    _loc_3.title = _loc_4[_titleField];
                }
                if (_loc_4.hasOwnProperty(_colorField))
                {
                    _loc_3.color = Utils.toColor(_loc_4[_colorField]);
                }
                if (_loc_4.hasOwnProperty(_alphaField))
                {
                    _loc_3.alpha = _loc_4[_alphaField];
                }
                if (_loc_4.hasOwnProperty(_pulledField))
                {
                    _loc_3.pulled = _loc_4[_pulledField];
                }
                if (_loc_4.hasOwnProperty(_descriptionField))
                {
                    _loc_3.description = _loc_4[_descriptionField];
                }
                if (_loc_4.hasOwnProperty(_urlField))
                {
                    _loc_3.url = _loc_4[_urlField];
                }
                if (_loc_4.hasOwnProperty(_visibleInLegendField))
                {
                    _loc_3.visibleInLegend = _loc_4[_visibleInLegendField];
                }
                _loc_3.dataContext = _loc_4;
                _chartDataProvider.addItem(_loc_3);
                _loc_2 = _loc_2 + 1;
            }
            _chartCreated = false;
            calculatePercents();
            return;
        }// end function

        override protected function createChildren() : void
        {
            super.createChildren();
            _labelsContainer = new Sprite();
            _labelsContainer.mouseEnabled = false;
            _labelsContainer.mouseChildren = false;
            addChildAt(_labelsContainer, 0);
            _pieContainer = new Sprite();
            addChildAt(_pieContainer, 0);
            updateAmChartsLink();
            return;
        }// end function

        public function get visibleInLegendField() : String
        {
            return _visibleInLegendField;
        }// end function

        protected function rollOverSlice(param1:Number) : void
        {
            _slices[param1].alpha = _hoverAlpha;
            showBalloon(param1, true);
            var _loc_2:* = new PieChartEvent(PieChartEvent.ROLL_OVER_SLICE);
            _loc_2.index = param1;
            _loc_2.item = _chartDataProvider.getItemAt(param1) as Slice;
            dispatchEvent(_loc_2);
            return;
        }// end function

        protected function moveSlice(param1:Number, param2:Number, param3:Number, param4:Number, param5:Number, param6:Function) : void
        {
            var _loc_8:ExtendedSprite = null;
            var _loc_7:* = _slices[param1];
            if (_loc_7)
            {
                _loc_8 = _labelsTicks[param1];
                if (param5 == 0)
                {
                    _loc_7.x = param2;
                    _loc_7.y = param3;
                    _loc_7.alpha = param4;
                    if (_loc_8)
                    {
                        _loc_8.x = param2;
                        _loc_8.y = param3;
                    }
                }
                else
                {
                    _loc_7.tweens["x"] = new Tween(_loc_7, "x", param6, _loc_7.x, param2, param5);
                    _loc_7.tweens["y"] = new Tween(_loc_7, "y", param6, _loc_7.y, param3, param5);
                    _loc_7.tweens["alpha"] = new Tween(_loc_7, "alpha", param6, _loc_7.alpha, param4, param5);
                    if (_loc_8)
                    {
                        _loc_8.tweens["x"] = new Tween(_loc_8, "x", param6, _loc_8.x, param2, param5);
                        _loc_8.tweens["y"] = new Tween(_loc_8, "y", param6, _loc_8.y, param3, param5);
                    }
                }
            }
            return;
        }// end function

        public function get alphaField() : String
        {
            return _alphaField;
        }// end function

        protected function handleMouseEvent(event:MouseEvent) : void
        {
            var _loc_4:String = null;
            var _loc_5:String = null;
            var _loc_6:Object = null;
            var _loc_7:LegendEvent = null;
            var _loc_2:* = event.currentTarget as Wedge;
            var _loc_3:* = _loc_2.index;
            if (_loc_3 < _chartDataProvider.length)
            {
                _loc_4 = event.type;
                switch(_loc_4)
                {
                    case MouseEvent.CLICK:
                    {
                        clickSlice(_loc_3);
                        _loc_5 = LegendEvent.CLICK_MARKER;
                        break;
                    }
                    case MouseEvent.ROLL_OVER:
                    {
                        rollOverSlice(_loc_3);
                        _loc_5 = LegendEvent.ROLL_OVER_ITEM;
                        break;
                    }
                    case MouseEvent.ROLL_OUT:
                    {
                        rollOutSlice(_loc_3);
                        _loc_5 = LegendEvent.ROLL_OUT_ITEM;
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
                _loc_7 = new LegendEvent(_loc_5);
                _loc_7.index = _loc_3;
                _loc_7.item = _chartDataProvider.getItemAt(_loc_3);
                dispatchEvent(_loc_7);
            }
            return;
        }// end function

        override protected function handleLegendEvent(event:LegendEvent) : void
        {
            var _loc_2:* = event.type;
            var _loc_3:* = event.index;
            var _loc_4:* = _chartDataProvider.getItemAt(_loc_3) as Slice;
            var _loc_5:* = _loc_4.hidden;
            switch(_loc_2)
            {
                case LegendEvent.CLICK_MARKER:
                {
                    if (!_loc_5)
                    {
                        clickSlice(_loc_3);
                        _balloon.hide();
                    }
                    break;
                }
                case LegendEvent.CLICK_LABEL:
                {
                    if (!_loc_5)
                    {
                        clickSlice(_loc_3);
                        _balloon.hide();
                    }
                    break;
                }
                case LegendEvent.ROLL_OVER_ITEM:
                {
                    if (!_loc_5)
                    {
                        showBalloon(_loc_3, false);
                    }
                    break;
                }
                case LegendEvent.ROLL_OUT_ITEM:
                {
                    if (!_loc_5)
                    {
                        _balloon.hide();
                    }
                    break;
                }
                case LegendEvent.HIDE_ITEM:
                {
                    hideSlice(_loc_3);
                    break;
                }
                case LegendEvent.SHOW_ITEM:
                {
                    showSlice(_loc_3);
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

        protected function getMargins() : void
        {
            _marginTop = getStyle("marginTop");
            _marginBottom = getStyle("marginBottom");
            _marginLeft = getStyle("marginLeft");
            _marginRight = getStyle("marginRight");
            return;
        }// end function

        public function get colorField() : String
        {
            return _colorField;
        }// end function

        protected function calculatePercents() : void
        {
            var _loc_10:Slice = null;
            var _loc_11:Number = NaN;
            var _loc_12:Number = NaN;
            var _loc_13:Slice = null;
            var _loc_1:* = _chartDataProvider.length;
            var _loc_2:Number = 0;
            var _loc_3:* = getStyle("groupPercent");
            var _loc_4:* = getStyle("pieAlpha");
            var _loc_5:Number = 0;
            var _loc_6:* = getStyle("colors");
            var _loc_7:* = getStyle("pieBaseColor");
            var _loc_8:* = getStyle("pieBrightnessStep");
            var _loc_9:Number = 0;
            while (_loc_9 < _loc_1)
            {
                
                _loc_10 = _chartDataProvider.getItemAt(_loc_9) as Slice;
                if (_loc_10.value > 0)
                {
                    _loc_2 = _loc_2 + _loc_10.value;
                }
                if (!isNaN(_loc_7))
                {
                    _loc_6[_loc_9] = ColorUtil.adjustBrightness(_loc_7, _loc_8 * _loc_9);
                }
                if (isNaN(_loc_10.alpha))
                {
                    _loc_10.alpha = _loc_4;
                }
                if (isNaN(_loc_10.color))
                {
                    _loc_10.color = Utils.checkNaN(_loc_6[_loc_9], Math.round(Math.random() * 16777215));
                }
                _loc_9 = _loc_9 + 1;
            }
            _loc_9 = 0;
            while (_loc_9 < _loc_1)
            {
                
                _loc_10 = _chartDataProvider.getItemAt(_loc_9) as Slice;
                _loc_11 = _loc_10.value * 100 / _loc_2;
                if (_loc_11 < 0)
                {
                    _loc_11 = 0;
                }
                _loc_10.percents = _loc_11;
                _loc_10.index = _loc_9;
                if (_loc_10.percents < _loc_3)
                {
                    _loc_5 = _loc_5 + 1;
                }
                _loc_9 = _loc_9 + 1;
            }
            if (_loc_5 > 1)
            {
                _loc_12 = 0;
                _loc_9 = 0;
                while (_loc_9 < _loc_1)
                {
                    
                    _loc_10 = _chartDataProvider.getItemAt(_loc_9) as Slice;
                    if (_loc_10.percents < _loc_3)
                    {
                        _chartDataProvider.removeItemAt(_loc_9);
                        _loc_12 = _loc_12 + _loc_10.value;
                        _loc_1 = _loc_1 - 1;
                        _loc_9 = _loc_9 - 1;
                    }
                    _loc_9 = _loc_9 + 1;
                }
                _loc_13 = new Slice();
                _loc_13.value = _loc_12;
                _loc_13.title = getStyle("groupedTitle");
                _loc_13.color = Utils.checkNaN(getStyle("groupedColor"), _loc_6[(_chartDataProvider.length + 1)]);
                _loc_13.alpha = getStyle("groupedAlpha");
                _loc_13.pulled = getStyle("groupedPulled");
                _loc_13.description = getStyle("groupedDescription");
                _chartDataProvider.addItem(_loc_13);
                calculatePercents();
            }
            else
            {
                recalculatePercents();
            }
            return;
        }// end function

        protected function showLabels() : void
        {
            _labelsContainer.visible = true;
            return;
        }// end function

        public function get descriptionField() : String
        {
            return _descriptionField;
        }// end function

        public function set pulledField(param1:String) : void
        {
            _dataChanged = true;
            _pulledField = param1;
            invalidateProperties();
            invalidateDisplayList();
            return;
        }// end function

        public function get clipLabels() : Boolean
        {
            return _clipLabels;
        }// end function

        public function hideSlice(param1:Number) : void
        {
            var _loc_2:* = _chartDataProvider.getItemAt(param1) as Slice;
            _loc_2.hidden = true;
            recalculatePercents();
            invalidateDisplayList();
            return;
        }// end function

        protected function showBalloon(param1:Number, param2:Boolean) : void
        {
            var _loc_3:Slice = null;
            var _loc_4:Number = NaN;
            var _loc_5:Number = NaN;
            var _loc_6:Number = NaN;
            var _loc_7:Number = NaN;
            if (_balloonText)
            {
                _loc_3 = _chartDataProvider.getItemAt(param1) as Slice;
                _balloon.follow = param2;
                _loc_4 = ColorUtil.adjustBrightness(_loc_3.color, -25);
                _balloon.changeColor(_loc_4);
                _balloon.show(Utils.formatString(_balloonText, _loc_3, _numberFormatter, _percentFormatter));
                if (param2 == false)
                {
                    _loc_5 = 0;
                    if (_loc_3.pulled == true)
                    {
                        _loc_5 = _pullOutRadius;
                    }
                    _loc_6 = _pieContainer.x + _loc_3.ix * (_innerRadius + ((_radius - _innerRadius) / 2 + _loc_5));
                    _loc_7 = _pieContainer.y + _loc_3.iy * (_innerRadius + ((_radius - _innerRadius) / 2 + _loc_5));
                    _balloon.setPosition(_loc_6, _loc_7);
                }
            }
            return;
        }// end function

        public function set visibleInLegendField(param1:String) : void
        {
            _dataChanged = true;
            _visibleInLegendField = param1;
            invalidateProperties();
            invalidateDisplayList();
            return;
        }// end function

        override public function get legendDataProvider() : ArrayCollection
        {
            return _chartDataProvider;
        }// end function

        public function set alphaField(param1:String) : void
        {
            _dataChanged = true;
            _alphaField = param1;
            invalidateProperties();
            invalidateDisplayList();
            return;
        }// end function

        override protected function designMode() : void
        {
            valueField = "value";
            titleField = "title";
            this.setStyle("startEffect", Exponential.easeOut);
            this.setStyle("startDuration", 0);
            dataProvider = new ArrayCollection([{title:"sample 1", value:10}, {title:"sample 2", value:20}, {title:"sample 3", value:4}]);
            return;
        }// end function

        public function get titleField() : String
        {
            return _titleField;
        }// end function

        protected function recalculatePercents() : void
        {
            var _loc_4:Slice = null;
            var _loc_1:* = _chartDataProvider.length;
            var _loc_2:Number = 0;
            var _loc_3:Number = 0;
            while (_loc_3 < _loc_1)
            {
                
                _loc_4 = _chartDataProvider.getItemAt(_loc_3) as Slice;
                if (!_loc_4.hidden)
                {
                }
                if (_loc_4.value > 0)
                {
                    _loc_2 = _loc_2 + _loc_4.value;
                }
                _loc_3 = _loc_3 + 1;
            }
            _loc_3 = 0;
            while (_loc_3 < _loc_1)
            {
                
                _loc_4 = _chartDataProvider.getItemAt(_loc_3) as Slice;
                if (!_loc_4.hidden)
                {
                }
                if (_loc_4.value > 0)
                {
                    _loc_4.percents = _loc_4.value * 100 / _loc_2;
                }
                else
                {
                    _loc_4.percents = 0;
                }
                _loc_3 = _loc_3 + 1;
            }
            dispatchEvent(new Event("legendDataChanged"));
            return;
        }// end function

        protected function rollOutSlice(param1:Number) : void
        {
            var _loc_2:Slice = null;
            var _loc_3:PieChartEvent = null;
            if (param1 < _chartDataProvider.length)
            {
                _loc_2 = _chartDataProvider.getItemAt(param1) as Slice;
                _slices[param1].alpha = _loc_2.alpha;
                _balloon.hide();
                _loc_3 = new PieChartEvent(PieChartEvent.ROLL_OUT_SLICE);
                _loc_3.index = param1;
                _loc_3.item = _chartDataProvider.getItemAt(param1) as Slice;
                dispatchEvent(_loc_3);
            }
            return;
        }// end function

        public function showSlice(param1:Number) : void
        {
            var _loc_2:* = _chartDataProvider.getItemAt(param1) as Slice;
            _loc_2.hidden = false;
            recalculatePercents();
            invalidateDisplayList();
            return;
        }// end function

        public function set urlField(param1:String) : void
        {
            _dataChanged = true;
            _urlField = param1;
            invalidateProperties();
            invalidateDisplayList();
            return;
        }// end function

        protected function drawTicks() : void
        {
            var _loc_5:Slice = null;
            var _loc_6:UITextField = null;
            var _loc_7:Number = NaN;
            var _loc_8:Number = NaN;
            var _loc_9:Number = NaN;
            var _loc_10:Number = NaN;
            var _loc_11:Number = NaN;
            var _loc_12:Number = NaN;
            var _loc_13:Line = null;
            var _loc_1:* = getStyle("labelTickColor") as Number;
            var _loc_2:* = getStyle("labelTickAlpha") as Number;
            var _loc_3:* = _labels.length;
            var _loc_4:Number = 0;
            while (_loc_4 < _loc_3)
            {
                
                _loc_5 = _chartDataProvider.getItemAt(_loc_4) as Slice;
                if (!_loc_5.hidden)
                {
                }
                if (_labels[_loc_4])
                {
                    _loc_6 = _labels[_loc_4];
                    _loc_7 = _loc_5.ix * _radius;
                    _loc_8 = _loc_5.iy * _radius;
                    _loc_9 = _loc_6.x;
                    _loc_10 = _loc_6.y + _loc_6.height / 2;
                    _loc_12 = _loc_5.labelQuarter;
                    if (_loc_12 != 0)
                    {
                    }
                    if (_loc_12 == 1)
                    {
                        _loc_9 = _loc_9 - 6;
                        _loc_11 = _loc_9 + 5;
                    }
                    else
                    {
                        _loc_9 = _loc_9 + (_loc_6.width + 3);
                        _loc_11 = _loc_9 - 5;
                    }
                    _loc_13 = new Line([_loc_7, _loc_9, _loc_11], [_loc_8, _loc_10, _loc_10], _loc_1, _loc_2);
                    _labelsTicks[_loc_4].addChild(_loc_13);
                }
                _loc_4 = _loc_4 + 1;
            }
            return;
        }// end function

        protected function moveLabel(param1:Number, param2:Number, param3:Boolean, param4:Number) : void
        {
            var _loc_5:* = _chartDataProvider.getItemAt(param1) as Slice;
            _labels[param1].y = _labels[param1].y + _loc_5.iy * 3;
            checkOverlapping(param1, param2, param3, param4);
            return;
        }// end function

        public function set colorField(param1:String) : void
        {
            _dataChanged = true;
            _colorField = param1;
            invalidateProperties();
            invalidateDisplayList();
            return;
        }// end function

        protected function checkOutOfBounds() : void
        {
            var _loc_1:Number = NaN;
            var _loc_2:IUITextField = null;
            if (_radius > this.getStyle("minRadius"))
            {
                _loc_1 = 0;
                while (_loc_1 < _labels.length)
                {
                    
                    _loc_2 = _labels[_loc_1];
                    if (_loc_2)
                    {
                        if (_loc_2.y + _labelsContainer.y < 0)
                        {
                            _marginTop = _marginTop + 5;
                            invalidateDisplayList();
                        }
                        if (_loc_2.y + _labelsContainer.y + _loc_2.textHeight > this.height)
                        {
                            _marginBottom = _marginBottom + 5;
                            invalidateDisplayList();
                        }
                    }
                    _loc_1 = _loc_1 + 1;
                }
            }
            return;
        }// end function

        public function set descriptionField(param1:String) : void
        {
            _dataChanged = true;
            _descriptionField = param1;
            invalidateProperties();
            invalidateDisplayList();
            return;
        }// end function

        public function set urlTarget(param1:String) : void
        {
            _urlTarget = param1;
            return;
        }// end function

        public function get pulledField() : String
        {
            return _pulledField;
        }// end function

        protected function pullSlices() : void
        {
            var _loc_3:Slice = null;
            var _loc_1:* = _chartDataProvider.length;
            var _loc_2:Number = 0;
            while (_loc_2 < _loc_1)
            {
                
                _loc_3 = _chartDataProvider.getItemAt(_loc_2) as Slice;
                if (_loc_3.pulled == true)
                {
                    _loc_3.pulled = false;
                    clickSlice(_loc_2);
                }
                _loc_2 = _loc_2 + 1;
            }
            return;
        }// end function

        override public function styleChanged(param1:String) : void
        {
            super.styleChanged(param1);
            getMargins();
            if (param1)
            {
                if (param1 == "groupPercent")
                {
                    updateData();
                }
                if (ArrayUtil.getItemIndex(param1, ["colors", "pieAlpha", "pieBaseColor", "pieBrightnessStep", "groupPercent", "groupedTitle", "groupedColor", "groupedPulled", "groupedAlpha", "groupedDescription"]) != -1)
                {
                    updateDataStyles();
                }
                if (ArrayUtil.getItemIndex(param1, ["startAlpha", "startDuration", "startEffect", "sequencedAnimation", "startRadius"]) != -1)
                {
                    animateAgain();
                }
                invalidateDisplayList();
                return;
            }
            return;
        }// end function

        protected function arrangeLabels() : void
        {
            var _loc_1:Number = NaN;
            var _loc_5:Slice = null;
            var _loc_6:Number = NaN;
            var _loc_2:Number = 0;
            var _loc_3:Number = 0;
            var _loc_4:* = _chartDataProvider.length - 1;
            while (_loc_4 >= 0)
            {
                
                _loc_5 = _chartDataProvider.getItemAt(_loc_4) as Slice;
                if (_loc_5.labelQuarter == 0)
                {
                }
                if (!_loc_5.hidden)
                {
                }
                if (_labels[_loc_4])
                {
                    _loc_6 = _loc_5.index;
                    if (_loc_1)
                    {
                    }
                    if (_labels[_loc_4].y > _loc_1)
                    {
                        _labels[_loc_4].y = _loc_1;
                    }
                    callLater(checkOverlapping, [_loc_6, 0, true, 0]);
                    _loc_1 = _labels[_loc_4].y;
                    if (_loc_3 < _loc_1)
                    {
                        _loc_3 = _loc_1;
                    }
                    if (_loc_2 > _loc_1)
                    {
                        _loc_2 = _loc_1;
                    }
                }
                _loc_4 = _loc_4 - 1;
            }
            _loc_1 = NaN;
            _loc_4 = 0;
            while (_loc_4 < _chartDataProvider.length)
            {
                
                _loc_5 = _chartDataProvider.getItemAt(_loc_4) as Slice;
                if (_loc_5.labelQuarter == 1)
                {
                }
                if (!_loc_5.hidden)
                {
                }
                if (_labels[_loc_4])
                {
                    _loc_6 = _loc_5.index;
                    if (_loc_1)
                    {
                    }
                    if (_labels[_loc_4].y < _loc_1)
                    {
                        _labels[_loc_4].y = _loc_1;
                    }
                    callLater(checkOverlapping, [_loc_6, 1, false, 0]);
                    _loc_1 = _labels[_loc_4].y;
                    if (_loc_3 < _loc_1)
                    {
                        _loc_3 = _loc_1;
                    }
                    if (_loc_2 > _loc_1)
                    {
                        _loc_2 = _loc_1;
                    }
                }
                _loc_4 = _loc_4 + 1;
            }
            _loc_1 = NaN;
            _loc_4 = _chartDataProvider.length - 1;
            while (_loc_4 >= 0)
            {
                
                _loc_5 = _chartDataProvider.getItemAt(_loc_4) as Slice;
                if (_loc_5.labelQuarter == 2)
                {
                }
                if (!_loc_5.hidden)
                {
                }
                if (_labels[_loc_4])
                {
                    _loc_6 = _loc_5.index;
                    if (_loc_1)
                    {
                    }
                    if (_labels[_loc_4].y < _loc_1)
                    {
                        _labels[_loc_4].y = _loc_1;
                    }
                    callLater(checkOverlapping, [_loc_6, 2, true, 0]);
                    _loc_1 = _labels[_loc_4].y;
                    if (_loc_3 < _loc_1)
                    {
                        _loc_3 = _loc_1;
                    }
                    if (_loc_2 > _loc_1)
                    {
                        _loc_2 = _loc_1;
                    }
                }
                _loc_4 = _loc_4 - 1;
            }
            _loc_1 = NaN;
            _loc_4 = 0;
            while (_loc_4 < _chartDataProvider.length)
            {
                
                _loc_5 = _chartDataProvider.getItemAt(_loc_4) as Slice;
                if (_loc_5.labelQuarter == 3)
                {
                }
                if (!_loc_5.hidden)
                {
                }
                if (_labels[_loc_4])
                {
                    _loc_6 = _loc_5.index;
                    if (_loc_1)
                    {
                    }
                    if (_labels[_loc_4].y > _loc_1)
                    {
                        _labels[_loc_4].y = _loc_1;
                    }
                    callLater(checkOverlapping, [_loc_6, 3, false, 0]);
                    _loc_1 = _labels[_loc_4].y;
                    if (_loc_3 < _loc_1)
                    {
                        _loc_3 = _loc_1;
                    }
                    if (_loc_2 > _loc_1)
                    {
                        _loc_2 = _loc_1;
                    }
                }
                _loc_4 = _loc_4 + 1;
            }
            if (!_clipLabels)
            {
                callLater(checkOutOfBounds);
            }
            callLater(drawTicks);
            return;
        }// end function

        override protected function updateDataStyles() : void
        {
            var _loc_3:Slice = null;
            var _loc_1:* = _chartDataProvider.length;
            var _loc_2:Number = 0;
            while (_loc_2 < _loc_1)
            {
                
                _loc_3 = _chartDataProvider.getItemAt(_loc_2) as Slice;
                _loc_3.color = NaN;
                _loc_3.alpha = NaN;
                _loc_2 = _loc_2 + 1;
            }
            calculatePercents();
            return;
        }// end function

        public function get urlField() : String
        {
            return _urlField;
        }// end function

        public function set clipLabels(param1:Boolean) : void
        {
            _clipLabels = param1;
            return;
        }// end function

        public function get urlTarget() : String
        {
            return _urlTarget;
        }// end function

        public function clickSlice(param1:Number) : void
        {
            var x:Number;
            var y:Number;
            var pieEvent:PieChartEvent;
            var url:String;
            var request:URLRequest;
            var count:Number;
            var i:Number;
            var index:* = param1;
            _balloon.hide();
            var slice:* = _slices[index];
            var pieDataItem:* = _chartDataProvider.getItemAt(index) as Slice;
            pieEvent = new PieChartEvent(PieChartEvent.CLICK_SLICE);
            pieEvent.index = index;
            pieEvent.item = pieDataItem;
            dispatchEvent(pieEvent);
            url = pieDataItem.url;
            if (url)
            {
                request = new URLRequest(url);
                try
                {
                    navigateToURL(request, _urlTarget);
                }
                catch (e:Error)
                {
                    showError("Can not get the url: " + url);
                }
            }
            if (_pullOutRadius > 0)
            {
                if (!pieDataItem.hidden)
                {
                    if (pieDataItem.pulled == false)
                    {
                        x = _pullOutRadius * _slices[index].ix;
                        y = _pullOutRadius * _slices[index].iy;
                        pieDataItem.pulled = true;
                        pieEvent = new PieChartEvent(PieChartEvent.PULL_OUT_SLICE);
                        pieEvent.index = index;
                        pieEvent.item = pieDataItem;
                        dispatchEvent(pieEvent);
                    }
                    else
                    {
                        x;
                        y;
                        pieDataItem.pulled = false;
                        pieEvent = new PieChartEvent(PieChartEvent.PULL_IN_SLICE);
                        pieEvent.index = index;
                        pieEvent.item = pieDataItem;
                        dispatchEvent(pieEvent);
                    }
                    moveSlice(index, x, y, pieDataItem.alpha, _pullOutDuration, _pullOutEffect);
                }
                if (_pullOutOnlyOne)
                {
                    count = _chartDataProvider.length;
                    i;
                    while (i < count)
                    {
                        
                        pieDataItem = _chartDataProvider.getItemAt(i) as Slice;
                        if (!pieDataItem.hidden)
                        {
                        }
                        if (i != index)
                        {
                        }
                        if (pieDataItem.pulled == true)
                        {
                            moveSlice(i, 0, 0, pieDataItem.alpha, _pullOutDuration, _pullOutEffect);
                            pieDataItem.pulled = false;
                            pieEvent = new PieChartEvent(PieChartEvent.PULL_IN_SLICE);
                            pieEvent.index = i;
                            pieEvent.item = pieDataItem;
                            dispatchEvent(pieEvent);
                        }
                        i = (i + 1);
                    }
                }
            }
            return;
        }// end function

        protected function createPie() : void
        {
            var _loc_1:UITextFormat = null;
            var _loc_10:Slice = null;
            var _loc_32:Number = NaN;
            var _loc_33:IUITextField = null;
            var _loc_34:Number = NaN;
            var _loc_35:Number = NaN;
            var _loc_36:Number = NaN;
            var _loc_37:Number = NaN;
            var _loc_38:Number = NaN;
            var _loc_39:Wedge = null;
            var _loc_40:Number = NaN;
            var _loc_41:Number = NaN;
            var _loc_42:ExtendedSprite = null;
            var _loc_43:Number = NaN;
            var _loc_44:IUITextField = null;
            var _loc_45:Number = NaN;
            var _loc_46:Number = NaN;
            var _loc_47:Number = NaN;
            var _loc_2:* = getStyle("labelRadius") as Number;
            var _loc_3:* = getStyle("labelWidth") as Number;
            var _loc_4:* = getStyle("angle");
            var _loc_5:* = getStyle("adjustLabelWidth");
            var _loc_6:* = getStyle("labelsEnabled");
            var _loc_7:* = (this.width - _marginLeft - _marginRight) / 2 + _marginLeft;
            var _loc_8:* = (this.height - _marginTop - _marginBottom) / 2 + _marginTop;
            var _loc_9:* = getStyle("labelText");
            var _loc_11:* = _chartDataProvider.length;
            var _loc_12:Number = 0;
            if (_loc_5)
            {
            }
            if (_loc_6)
            {
                _loc_32 = 0;
                while (_loc_32 < _loc_11)
                {
                    
                    _loc_10 = _chartDataProvider.getItemAt(_loc_32) as Slice;
                    _loc_33 = IUITextField(createInFontContext(UITextField));
                    _loc_1 = determineTextFormatFromStyles();
                    _loc_33.width = _loc_3;
                    _loc_33.multiline = true;
                    _loc_33.wordWrap = true;
                    _loc_33.selectable = false;
                    _loc_33.antiAliasType = _loc_1.antiAliasType;
                    _loc_33.gridFitType = _loc_1.gridFitType;
                    _loc_33.sharpness = _loc_1.sharpness;
                    _loc_33.thickness = _loc_1.thickness;
                    if (systemManager)
                    {
                    }
                    _loc_33.embedFonts = systemManager.isFontFaceEmbedded(_loc_1);
                    _loc_33.defaultTextFormat = _loc_1;
                    _loc_33.htmlText = Utils.formatString(_loc_9, _loc_10, _numberFormatter, _percentFormatter);
                    _loc_33.height = 0;
                    if (_loc_12 < _loc_33.textWidth + 6)
                    {
                        _loc_12 = _loc_33.textWidth + 6;
                    }
                    _loc_32 = _loc_32 + 1;
                }
                if (_loc_12 < _loc_3)
                {
                    _loc_3 = _loc_12;
                }
            }
            _pieContainer.x = _loc_7;
            _pieContainer.y = _loc_8;
            _labelsContainer.x = _loc_7;
            _labelsContainer.y = _loc_8;
            _pieContainer.filters = _filters;
            _timeOuts = new Array();
            _slices = new Array();
            _labels = new Array();
            _labelsTicks = new Array();
            _pullOutDuration = getStyle("pullOutDuration");
            _pullOutEffect = getStyle("pullOutEffect");
            _pullOutOnlyOne = getStyle("pullOutOnlyOne");
            _balloonText = getStyle("balloonText");
            _hoverAlpha = getStyle("hoverAlpha");
            _radius = Utils.toCoordinate(getStyle("radius") as String, this.width, this.height);
            _pullOutRadius = Utils.toCoordinate(String(getStyle("pullOutRadius")), _radius);
            if (_loc_9)
            {
            }
            if (!_loc_6)
            {
                _loc_3 = 0;
                _loc_2 = 0;
            }
            if (!_radius)
            {
                if (_loc_2 >= 0)
                {
                    _loc_34 = this.width - _marginLeft - _marginRight - _loc_3 * 2;
                }
                else
                {
                    _loc_34 = this.width - _marginLeft - _marginRight;
                }
                _loc_35 = this.height - _marginTop - _marginBottom;
                _radius = Math.min(_loc_34, _loc_35);
                if (_loc_35 < _loc_34)
                {
                    _radius = _radius / (1 - _loc_4 / 90);
                    if (_radius > _loc_34)
                    {
                        _radius = _loc_34;
                    }
                }
                if (_loc_2 >= 0)
                {
                    _radius = _radius - (_loc_2 + _pullOutRadius) * 1.8;
                }
                else
                {
                    _radius = _radius - _pullOutRadius * 1.8;
                }
                _radius = _radius / 2;
            }
            var _loc_13:* = getStyle("minRadius");
            if (_radius < _loc_13)
            {
                _radius = _loc_13;
            }
            _innerRadius = Utils.toCoordinate(String(getStyle("innerRadius")), _radius);
            if (_innerRadius >= _radius)
            {
                _innerRadius = _radius - 1;
            }
            var _loc_14:* = getStyle("depth3D") as Number;
            var _loc_15:* = Utils.fitToBounds(getStyle("startAngle") as Number, 0, 360);
            if (_loc_14 > 0)
            {
                if (_loc_15 >= 270)
                {
                    _loc_15 = 270;
                }
                else
                {
                    _loc_15 = 90;
                }
            }
            var _loc_16:* = _radius - _radius * _loc_4 / 90;
            var _loc_17:* = getStyle("outlineColor");
            var _loc_18:* = getStyle("outlineAlpha");
            var _loc_19:* = getStyle("outlineThickness");
            var _loc_20:* = getStyle("gradient");
            var _loc_21:* = getStyle("gradientRatio");
            var _loc_22:* = Utils.toCoordinate(String(getStyle("startRadius")), _radius);
            var _loc_23:* = getStyle("startAlpha");
            var _loc_24:* = getStyle("startDuration");
            var _loc_25:* = getStyle("startEffect");
            var _loc_26:* = getStyle("sequencedAnimation");
            var _loc_27:* = _loc_24 / _loc_11 * 500;
            var _loc_28:* = getStyle("labelTickColor");
            var _loc_29:* = getStyle("labelTickAlpha");
            var _loc_30:* = getStyle("hideLabelsPercent");
            var _loc_31:Number = 0;
            while (_loc_31 < _loc_11)
            {
                
                _loc_10 = _chartDataProvider.getItemAt(_loc_31) as Slice;
                if (_loc_10.hidden == false)
                {
                }
                if (_loc_10.percents > 0)
                {
                    _loc_36 = (-_loc_10.percents) * 360 / 100;
                    _loc_37 = _loc_10.color;
                    _loc_38 = _loc_10.alpha;
                    _loc_39 = new Wedge(_loc_15, _loc_36, _loc_37, _radius, _loc_16, _innerRadius, 1, _loc_17, _loc_18, _loc_19, _loc_14, _loc_20, _loc_21);
                    _loc_39.index = _loc_31;
                    _slices[_loc_31] = _loc_39;
                    _loc_40 = _loc_39.ix;
                    _loc_41 = _loc_39.iy;
                    _loc_10.ix = _loc_40;
                    _loc_10.iy = _loc_41;
                    _loc_10.sprite = _loc_39;
                    _loc_39.x = _loc_40 * _loc_22;
                    _loc_39.y = _loc_41 * _loc_22;
                    _loc_39.alpha = _loc_23;
                    if (_loc_15 <= 90)
                    {
                    }
                    if (_loc_15 < 0)
                    {
                        if (_loc_15 <= 360)
                        {
                        }
                    }
                    if (_loc_15 > 270)
                    {
                        _pieContainer.addChild(_loc_39);
                    }
                    else
                    {
                        if (_loc_15 <= 270)
                        {
                        }
                        if (_loc_15 <= 180)
                        {
                            if (_loc_15 <= 180)
                            {
                            }
                        }
                        if (_loc_15 > 90)
                        {
                            _pieContainer.addChildAt(_loc_39, 0);
                        }
                    }
                    _loc_39.addEventListener(MouseEvent.ROLL_OVER, handleMouseEvent);
                    _loc_39.addEventListener(MouseEvent.ROLL_OUT, handleMouseEvent);
                    _loc_39.addEventListener(MouseEvent.CLICK, handleMouseEvent);
                    if (_loc_10.url)
                    {
                        _loc_39.buttonMode = true;
                    }
                    if (_loc_6)
                    {
                    }
                    if (_loc_9)
                    {
                    }
                    if (_loc_10.percents >= _loc_30)
                    {
                        _loc_42 = new ExtendedSprite();
                        _labelsContainer.addChild(_loc_42);
                        _loc_43 = _loc_15 + _loc_36 / 2;
                        if (_loc_43 <= 0)
                        {
                            _loc_43 = _loc_43 + 360;
                        }
                        _loc_44 = IUITextField(createInFontContext(UITextField));
                        _loc_1 = determineTextFormatFromStyles();
                        _loc_44.width = _loc_3;
                        _loc_44.multiline = true;
                        _loc_44.wordWrap = true;
                        _loc_44.selectable = false;
                        _loc_44.antiAliasType = _loc_1.antiAliasType;
                        _loc_44.gridFitType = _loc_1.gridFitType;
                        _loc_44.sharpness = _loc_1.sharpness;
                        _loc_44.thickness = _loc_1.thickness;
                        if (systemManager)
                        {
                        }
                        _loc_44.embedFonts = systemManager.isFontFaceEmbedded(_loc_1);
                        if (_loc_2 >= 0)
                        {
                            if (_loc_43 <= 90)
                            {
                            }
                            if (_loc_43 >= 0)
                            {
                                _loc_45 = 0;
                                _loc_1.align = TextFormatAlign.LEFT;
                            }
                            else
                            {
                                if (_loc_43 <= 360)
                                {
                                }
                                if (_loc_43 > 270)
                                {
                                    _loc_45 = 1;
                                    _loc_1.align = TextFormatAlign.LEFT;
                                }
                                else
                                {
                                    if (_loc_43 <= 270)
                                    {
                                    }
                                    if (_loc_43 > 180)
                                    {
                                        _loc_45 = 2;
                                        _loc_1.align = TextFormatAlign.RIGHT;
                                    }
                                    else
                                    {
                                        if (_loc_43 <= 180)
                                        {
                                        }
                                        if (_loc_43 > 90)
                                        {
                                            _loc_45 = 3;
                                            _loc_1.align = TextFormatAlign.RIGHT;
                                        }
                                    }
                                }
                            }
                            _loc_10.labelQuarter = _loc_45;
                        }
                        else
                        {
                            _loc_1.align = TextFormatAlign.CENTER;
                        }
                        _loc_44.defaultTextFormat = _loc_1;
                        _loc_44.htmlText = Utils.formatString(_loc_9, _loc_10, _numberFormatter, _percentFormatter);
                        if (_loc_2 >= 0)
                        {
                            _loc_44.width = Math.min(_loc_44.textWidth + 7, _loc_3);
                        }
                        _labels[_loc_31] = _loc_44;
                        _labelsTicks[_loc_31] = _loc_42;
                        _loc_44.x = _loc_40 * (_radius + _loc_2);
                        _loc_44.y = _loc_41 * (_radius + _loc_2);
                        if (_loc_2 >= 0)
                        {
                            _loc_46 = (-_loc_44.textHeight) / 2 - 2;
                            if (_loc_45 != 0)
                            {
                            }
                            if (_loc_45 == 1)
                            {
                                _loc_44.x = _loc_44.x + 5;
                            }
                            else
                            {
                                _loc_44.x = _loc_44.x + (-_loc_44.width - 5);
                            }
                            _loc_44.y = _loc_44.y + _loc_46;
                        }
                        else
                        {
                            _loc_44.x = _loc_44.x - _loc_3 / 2;
                            _loc_44.y = _loc_44.y - _loc_44.textHeight / 2;
                        }
                        _loc_42.addChild(DisplayObject(_loc_44));
                        _loc_44.height = _loc_44.textHeight + 4;
                    }
                    _loc_15 = _loc_15 - _loc_10.percents * 360 / 100;
                    if (_loc_15 <= 0)
                    {
                        _loc_15 = _loc_15 + 360;
                    }
                }
                _loc_31 = _loc_31 + 1;
            }
            if (_loc_2 > 0)
            {
                arrangeLabels();
            }
            _loc_31 = 0;
            while (_loc_31 < _loc_11)
            {
                
                _loc_10 = _chartDataProvider.getItemAt(_loc_31) as Slice;
                _loc_38 = _loc_10.alpha;
                if (!_loc_10.hidden)
                {
                    if (!_chartCreated)
                    {
                        if (_loc_26 == true)
                        {
                            _loc_47 = setTimeout(moveSlice, _loc_27 * _loc_31, _loc_31, 0, 0, _loc_38, _loc_24, _loc_25);
                            _timeOuts.push(_loc_47);
                        }
                        else
                        {
                            moveSlice(_loc_31, 0, 0, _loc_38, _loc_24, _loc_25);
                        }
                    }
                    else if (_loc_10.pulled)
                    {
                        moveSlice(_loc_31, _pullOutRadius * _slices[_loc_31].ix, _pullOutRadius * _slices[_loc_31].iy, _loc_38, 0, _loc_25);
                    }
                    else
                    {
                        moveSlice(_loc_31, 0, 0, _loc_38, 0, _loc_25);
                    }
                }
                _loc_31 = _loc_31 + 1;
            }
            dispatchDataUpdatedEvent();
            if (!_chartCreated)
            {
                _labelsContainer.visible = false;
                _loc_47 = setTimeout(showLabels, _loc_24 * 1000);
                _timeOuts.push(_loc_47);
                _loc_47 = setTimeout(pullSlices, _loc_24 * 1200);
                _timeOuts.push(_loc_47);
            }
            else
            {
                _labelsContainer.visible = true;
            }
            _chartCreated = true;
            return;
        }// end function

        public function destroy() : void
        {
            var _loc_1:Number = NaN;
            var _loc_2:String = null;
            var _loc_3:Wedge = null;
            var _loc_4:ExtendedSprite = null;
            var _loc_5:Number = NaN;
            if (_slices)
            {
                _loc_1 = 0;
                while (_loc_1 < _slices.length)
                {
                    
                    _loc_3 = _slices[_loc_1];
                    if (_loc_3)
                    {
                        for (_loc_2 in _loc_3.tweens)
                        {
                            
                            _loc_3.tweens[_loc_2].stop();
                        }
                    }
                    _loc_1 = _loc_1 + 1;
                }
            }
            if (_labelsTicks)
            {
                _loc_1 = 0;
                while (_loc_1 < _labelsTicks.length)
                {
                    
                    _loc_4 = _labelsTicks[_loc_1];
                    if (_loc_4)
                    {
                        for (_loc_2 in _loc_4.tweens)
                        {
                            
                            _loc_4.tweens[_loc_2].stop();
                        }
                    }
                    _loc_1 = _loc_1 + 1;
                }
            }
            if (_timeOuts)
            {
                _loc_5 = 0;
                while (_loc_5 < _timeOuts.length)
                {
                    
                    clearTimeout(_timeOuts[_loc_5]);
                    _loc_5 = _loc_5 + 1;
                }
            }
            Utils.removeChildren(_pieContainer);
            Utils.removeChildren(_labelsContainer);
            return;
        }// end function

        public function animateAgain() : void
        {
            _chartCreated = false;
            invalidateDisplayList();
            return;
        }// end function

        private static function initStyles() : Boolean
        {
            var styleDeclaration:* = StyleManager.getStyleDeclaration("AmPieChart");
            if (!styleDeclaration)
            {
                styleDeclaration = new CSSStyleDeclaration();
            }
            styleDeclaration.defaultFactory = function () : void
            {
                this.colors = [16715520, 16737792, 16752129, 16568834, 16318209, 11591177, 315925, 888527, 873169, 2755792, 9047247, 13438324, 7687659, 14540253, 10066329, 3355443, 0, 5702442, 13276966, 10027008, 4918309];
                this.pieAlpha = 1;
                this.pieBaseColor = NaN;
                this.pieBrightnessStep = 30;
                this.groupPercent = 0;
                this.groupedTitle = "Other";
                this.groupedColor = NaN;
                this.groupedPulled = false;
                this.groupedAlpha = 1;
                this.groupedDescription = undefined;
                this.marginLeft = 0;
                this.marginTop = 10;
                this.marginBottom = 10;
                this.marginRight = 0;
                this.radius = NaN;
                this.minRadius = 10;
                this.hoverAlpha = 1;
                this.depth3D = 0;
                this.startAngle = 90;
                this.innerRadius = 0;
                this.angle = 0;
                this.outlineColor = 16777215;
                this.outlineAlpha = 0;
                this.outlineThickness = 0;
                this.gradient = "none";
                this.gradientRatio = [-20, 80];
                this.startRadius = 500;
                this.startAlpha = 0;
                this.startDuration = 0;
                this.startEffect = Bounce.easeOut;
                this.sequencedAnimation = true;
                this.labelsEnabled = true;
                this.labelRadius = 30;
                this.labelTickColor = 0;
                this.labelTickAlpha = 0.2;
                this.labelText = "[[title]]: [[percents]]%";
                this.labelWidth = 120;
                this.adjustLabelWidth = true;
                this.hideLabelsPercent = 0;
                this.pullOutRadius = 15;
                this.pullOutDuration = 1;
                this.pullOutEffect = Bounce.easeOut;
                this.pullOutOnlyOne = false;
                this.balloonText = "[[title]]: [[percents]]% ([[value]]) <br>[[description]]";
                return;
            }// end function
            ;
            StyleManager.setStyleDeclaration("AmPieChart", styleDeclaration, false);
            return true;
        }// end function

    }
}
